﻿@{
    var sidebarType = TempData.Get<string>("SidebarType", string.Empty);

    Func<string, string> subMenu = (SidebarType) =>
    {

        if (sidebarType == SidebarType)
            return "class=active";
        else
            return string.Empty;
    };
    var accountTypes = new AccountBindingService().GetAccountTypes(true);
    var user = UserContext.CurrentUser;
}
@Styles.Render("~/Bundle/Styles/Uploader")
<div class="col-xs-2">
    <div class="jh-space-left">
        <div class="jh-user-head">
            @Html.ShowUserAvatar(userId: user.UserId, avatarSizeType: AvatarSizeType.Big, enableClientCaching: false, enableNavigate: true, isShowUserCard: false)
            <button class="btn btn-default layerAvatar"><i class="fa fa-pencil" aria-hidden="true"></i></button>
        </div>
        <ul class="list-unstyled">
            <li @subMenu("UserSetting")><a href="@SiteUrls.Instance().UserSetting()">用户资料</a></li>
            @if (accountTypes != null && accountTypes.Any()&&Utility.CheckThirdPartyLogin())
            {
            <li @subMenu("AccountBinding")><a href="@SiteUrls.Instance().AccountBinding()">帐号绑定</a></li>
            }
            <li @subMenu("MyNotice")><a href="@SiteUrls.Instance().MyNotice()">我的通知</a></li>
            <li @subMenu("MyRank")><a href="@SiteUrls.Instance().MyRank()">我的等级</a></li>
        </ul>
    </div>
</div>

<script type="text/javascript">
    require(['jquery', 'tnlayer'], function ($, tnlayer) {
        $(".layerAvatar").click(function () {
            tnlayer.layermodal('头像设置', '@CachedUrlHelper.Action("_Avatar", "UserSpace")', '550px', '510px');
        });
    })
</script>
